﻿Imports IIC.Forms.Edit

Namespace Forms.List
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class frmStudentLessonCreditList
        Inherits frmBaseGrid
        Implements IStudentContainingGrid

#Region "Designer"

        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        Friend WithEvents ucStudentLessonExceptionList As ucStudentLessonExceptionList

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.ucStudentLessonExceptionList = New IIC.ucStudentLessonExceptionList()
            Me.pnlGrid.SuspendLayout()
            Me.SuspendLayout()
            '
            'pnlGrid
            '
            Me.pnlGrid.Controls.Add(Me.ucStudentLessonExceptionList)
            Me.pnlGrid.Location = New System.Drawing.Point(0, 53)
            Me.pnlGrid.Size = New System.Drawing.Size(760, 389)
            '
            'ucStudentLessonExceptionList
            '
            Me.ucStudentLessonExceptionList.Dock = System.Windows.Forms.DockStyle.Fill
            Me.ucStudentLessonExceptionList.Location = New System.Drawing.Point(0, 0)
            Me.ucStudentLessonExceptionList.Name = "ucStudentLessonExceptionList"
            Me.ucStudentLessonExceptionList.Size = New System.Drawing.Size(760, 389)
            Me.ucStudentLessonExceptionList.TabIndex = 0
            '
            'frmStudentLessonExceptionList
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(760, 442)
            Me.Name = "frmStudentLessonExceptionList"
            Me.ShowConfigButton = True
            Me.ShowExcelButton = True
            Me.ShowPrintButton = True
            Me.ShowSearch = True
            Me.Text = "Student Lesson Exception List"
            Me.Controls.SetChildIndex(Me.pnlGrid, 0)
            Me.pnlGrid.ResumeLayout(False)
            Me.ResumeLayout(False)

        End Sub

#End Region

#Region "Standard Code"

        Private Sub frmStudentLessonExceptionList_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
           Handles Me.Load


            Me.grdData.loadGrid()

        End Sub

        ''' <summary>
        ''' This function is common to all forms that inherit from class frmBaseGrid
        ''' It priovides a common name to the underlying grid control that shows the records
        ''' </summary>
        Public Overrides Function grdData() As org.codegen.win.controls.Grid.CGBaseGrid
            Return Me.ucStudentLessonExceptionList.grdStudentLessonException
        End Function

        Protected Sub DeleteRecordConfirmed(ByVal sender As System.Object) Handles Me.gridDeleteRecordConfirmed

            Dim m As New StudentLessonCreditDBMapper
            Dim mo As StudentLessonCredit = m.findByKey(Me.grdData.IdValue)
            Call m.delete(mo)

        End Sub

#End Region

        Public Overrides Function PrepareEditForm(ByVal IdValue As Integer, ByVal editForm As org.codegen.win.controls.frmBaseEdit) As Boolean

            If MyBase.PrepareEditForm(IdValue, editForm) Then
                CType(editForm, frmStudentLessonExceptionDetails).DefaultLessonId = Me.DefaultLessonId
                CType(editForm, frmStudentLessonExceptionDetails).DefaultStudentId = Me.DefaultStudentId
                Return True
            Else
                Return False
            End If

        End Function

        Private _DefaultStudentId As Integer
        Private _DefaultLessonId As Integer

        Public Property DefaultLessonId() As Integer
            Get
                Return _DefaultLessonId
            End Get
            Set(ByVal value As Integer)
                _DefaultLessonId = value
                If value > 0 Then
                    Me.grdData.hideColumn("LessonId")
                End If
            End Set
        End Property
        Public Property DefaultStudentId() As Integer
            Get
                Return _DefaultStudentId
            End Get
            Set(ByVal value As Integer)
                _DefaultStudentId = value
                Me.grdData.hideColumn("StudentId")
            End Set
        End Property

    End Class

End Namespace

